<!--
 * @Author: wwssaabb
 * @Date: 2021-05-26 08:19:22
 * @LastEditTime: 2021-05-26 08:28:21
 * @FilePath: \demo\canvas_demo\demo_API\line.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>canvas_demo line</title>
  <style>
    *{
      margin: 0;
      padding:0;
    }
    body{
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  </style>
</head>
<body>
  <canvas id="canvas1" width="800px" height="600px"></canvas>

  <script type="text/javascript">
    let canvas=document.querySelector('#canvas1')
    let ctx=canvas.getContext('2d')
    
    ctx.moveTo(200,100)
    ctx.lineTo(400,200)
    ctx.lineTo(600,600)
    ctx.lineTo(700,100)

    ctx.stroke()

  </script>

</body>
</html>